<?php
// R0910CMS 
// created by TLightSky
// time : 20100323

if(!defined("IN_R0910CMS")) {
    exit("Access Denied!");
}

class R_View {
	private $_sm;
	public function __construct($sm,$path) {
		//echo $path;
		$this->_sm = &$sm;
		$sm -> left_delimiter = '{=';
		$sm -> right_delimiter = '=}';
		if(!is_dir($path) ) {
			mkdir($path);
		}
		if(!is_dir($path.'templates_c')) {
			mkdir($path.'templates_c');
			if(!is_dir($path.'cache')) {
				mkdir($path.'cache');
			}
			if(!is_dir($path.'config')) {
				mkdir($path.'config');
			}
		}
		$sm->template_dir    = $path;
		$sm->compile_dir = $path.'templates_c';
		$sm->cache_dir           = $path.'cache';
		$sm->config_dir           = $path.'config';
	}
	public function set($k,$v)  {
		$this->_sm->assign($k,$v);
		return $this;
	}
	public function display($page) {
		//pr($this->_sm->template_dir);
		return $this->_sm->display($page);
	}
	public function & getSmarty() {
		return $this->_sm;
	}
	public function & setSmarty(&$sm) {
		$this->_sm = $sm;
	}
}
